package cn.gson.fengboot.model.dao;

import cn.gson.fengboot.model.pojos.Lxsfy;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface LxsfyDao extends CrudRepository<Lxsfy,Integer> {

    //统计图类型分布查询
    @Query(nativeQuery = true,value = "SELECT count(*),d.emp_name FROM lxsfy e LEFT JOIN qemp_from d  on e.emp_id= d.emp_id where e.xsfy_zhuangtai=1 and d.emp_name=?1 and e.xsfy_spzt='已审核' GROUP BY d.emp_name")
    public Integer xsfyfb(String Type);

    //统计图类型分布查询
    @Query(nativeQuery = true,value = "SELECT count(*),e.xsfy_lb FROM lxsfy e  where e.xsfy_zhuangtai=1  and e.xsfy_lb =?1")
    public Integer xsfylbfb(String Type);

    //统计图员工费用统计
    @Query(nativeQuery = true,value = "SELECT e.xsfy_je FROM lxsfy e LEFT JOIN qemp_from d  on e.emp_id= d.emp_id" +
            " where e.xsfy_zhuangtai=1  and e.xsfy_spzt='已审核' and d.emp_name=?1")
    public List<Integer> ygfytj(String Type);

    //统计图对应客户费用统计
    @Query(nativeQuery = true,value = "SELECT e.xsfy_je FROM lxsfy e where e.xsfy_zhuangtai=1  and e.xsfy_spzt='已审核' and e.xsfy_kh=?1")
    public List<Integer> dykhxsfy(String Type);


    //费用类别统计
    @Query(nativeQuery = true,value = "SELECT e.xsfy_je FROM lxsfy e where e.xsfy_zhuangtai=1  and e.xsfy_spzt='已审核' and e.xsfy_lb=?1")
    public List<Integer> zxfylb(String Type);


}
